package com.sky.mapper.common;

import com.sky.pojo.SetmealDish;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {
    /**
     * 添加套餐关联菜品
     * @param setmealDishes
     */
    void add(List<SetmealDish> setmealDishes);

    /**
     * 查询回显之套餐菜品
     * @param setmealId
     * @return
     */
    List<SetmealDish> getById(Integer setmealId);

    /**
     * 删除套餐中的菜品
     * @param ids
     */
    void delete(List<Long> ids);

    /**
     * 计数套餐中停售菜品数量
     * @param id
     * @return
     */
    @Select("select count(*) from setmeal_dish s,dish d where s.dish_id=d.id and s.setmeal_id=#{id} and d.status=0 ")
    int stopSaleCount(Integer id);
}
